package mybatis.sqlsession;

import mybatis.cfg.Configuration;
import mybatis.sqlsession.defaults.DefaultSqlSessionFactory;
import utils.XMLConfigBuilder;

import java.io.InputStream;

public class SqlSessionFactoryBuilder {
  /**
   * 返回创建的工厂
   * @param config
   * @return
   */
  public DefaultSqlSessionFactory build(InputStream config) {
    Configuration conf = XMLConfigBuilder.loadConfiguration(config);
    return new DefaultSqlSessionFactory(conf);
  }
}
